<template>
    <!-- pages/index/myMessage.wxml -->
    <view class="weui-cells demo_badge_cells">
        <view aria-labelledby="js_a11y_nt js_a11y_comma js_a11y_nb" class="weui-cell weui-cell_active weui-cell_access" aria-role="link" v-for="(item, index) in list" :key="index">
            <view class="weui-cell__hd" :aria-hidden="true">
                <image :src="item.portrait + ' '" style="height: 100rpx; width: 100rpx"></image>
            </view>

            <view class="weui-cell__bd" :aria-hidden="true" id="b1_txt1" style="margin-left: 15rpx">
                <text>{{ item.nickname }}</text>
                <view class="demo_badge_desc" style="font-size: 26rpx; color: #888">{{ item.date }}</view>
            </view>

            <view @tap="goMsgDetail" :data-title="item">
                <text class="weui-cell__ft" :aria-hidden="true" id="b3_n2">详细信息</text>
            </view>
        </view>
    </view>
</template>

<script>
// pages/index/myMessage.js
export default {
    data() {
        return {
            list: [
                {
                    portrait: 'http://img4.imgtn.bdimg.com/it/u=2278879561,3737093311&fm=26&gp=0.jpg',
                    nickname: '联系人1',
                    text: 'yy好帅yy好帅yy好帅yy好帅yy好帅yy好帅yy好帅yy好帅yy好帅yy好帅yy好帅yy好帅yy好帅',
					date:'2022-02-01'
                },
                {
                    portrait: 'http://img4.imgtn.bdimg.com/it/u=2278879561,3737093311&fm=26&gp=0.jpg',
                    nickname: '联系人2',
                    text: 'yy我爹yy我爹yy我爹yy我爹yy我爹yy我爹yy我爹yy我爹yy我爹yy我爹yy我爹yy我爹yy我爹',
					date:'2021-02-01'
                }
            ]
        };
    }
    /**
     * Lifecycle function--Called when page load
     */,
    onLoad: function (options) {},
    /**
     * Lifecycle function--Called when page is initially rendered
     */
    onReady: function () {},
    /**
     * Lifecycle function--Called when page show
     */
    onShow: function () {},
    /**
     * Lifecycle function--Called when page hide
     */
    onHide: function () {},
    /**
     * Lifecycle function--Called when page unload
     */
    onUnload: function () {},
    /**
     * Page event handler function--Called when user drop down
     */
    onPullDownRefresh: function () {},
    /**
     * Called when page reach bottom
     */
    onReachBottom: function () {},
    /**
     * Called when user click on the top right corner to share
     */
    onShareAppMessage: function () {},
    methods: {
        goMsgDetail: function (e) {
            console.log(e);

            if (this.hasLogin) {
                uni.navigateTo({
                    url: e.currentTarget.dataset.url
                });
            } else {
                var portrait = e.currentTarget.dataset.title.portrait;
                var nickname = e.currentTarget.dataset.title.nickname;
                var text = e.currentTarget.dataset.title.text;
                uni.navigateTo({
                    url: '/pages/index/details/details?portrait=' + portrait + '&nickname=' + nickname + '&text=' + text
                });
            }
        }
    }
};
</script>
<style>
@import './myMessage.css';
</style>
